﻿using Rhino;
using Rhino.Commands;
using System;
using YangTools.Realization;

namespace YangTools
{
    public class AutoAreaRectangleCommand : Command
    {
        static AutoAreaRectangleCommand _instance;
        public AutoAreaRectangleCommand()
        {
            _instance = this;
        }

        ///<summary>The only instance of the AutoAreaRectangleCommand command.</summary>
        public static AutoAreaRectangleCommand Instance
        {
            get { return _instance; }
        }

        public override string EnglishName
        {
            get { return "AutoAreaRectangle"; }
        }

        /// <summary>
        /// 创建一个矩形，并在矩形中心添加文字物体标注矩形面积，且自动随着矩形尺寸更改
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            var ar = new AutoAreaRectangle();
            ar.Add();
            return Result.Success;
        }
    }
}